<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../style/ucs.css">
    <link rel="stylesheet" href="../content/font/iconfont.css">
    <link rel="stylesheet" href="../style/theme.css">
</head>
<body>
    <div id="giraffe"></div>
    <script type="text/javascript" src="../../dist/libs/u-eventhub.js"></script>
    <script type="text/javascript" src="../../dist/libs/engine.js"></script>
    <script type="text/javascript" src="../../dist/ucsmy-ui.js"></script>

    <script type="text/javascript">
        var accTypeDM = new UDM({
            value:0
        })

        var typeSituationDM = new UDM({
            value:{
                assetTypeId:0,  //0-3  依次表示不同类型
                disableType:0  //1 上面三个禁用   2  全部禁用
            },
            onClick:function (v) {
                PageDM.btn.setValue({disabled:!PageDM.btn.value.disabled});
                console.log(v)
            }
        })
        //企业姓名
        var companyNameDM = new UDM({
            value:'33',
            placeholder:"请输入企业名称",
            validator:[
                {type:"require",msg:"企业名称不能为空"}
            ]
        });
        //联系人姓名
        var contactsDM = new UDM({
            placeholder:"请输入联系人姓名",
            validator:[
                {type:"require",msg:"联系人姓名不能为空"}
            ]
        });
        //联系人电话
        var contactsPhoneDM = new UDM({
            placeholder:"请输入联系人电话",
            validator:[
                {type:"require",msg:"联系人电话不能为空"}
            ]
        });
        //开户银行
        var banksDM = new UDM({
            value:{
                selectIndex:null,
                selectValue:'',
                selectText:'',
                options:[]
            },
            onChange:function(v){
                console.log(v)
            }
        });
        //银行账号
        var bankNumDM = new UDM({
            placeholder:"请输入银行账号",
            validator:[
                {type:"require",msg:"银行账号不能为空"}
            ]
        });
        //同意协议
        var checkboxDM = new UDM({
            value:true,
            onClick:function(v){
                console.log(v)
            }
        });
        //立即申请
        var btnDM = new UDM({
            value:{
                disabled:true
            },
            onClick:function(){
                console.log("立即申请");
                console.log(PageDM.btn.getValue());
                UEventHub.emit('showResult',true,"186****0236")
            }
        });
        var userDM = new UDM({
            value:"",
            text:"您已阅读并接受《 绵阳市商业银行平台服务协议（企业版）》、《》约束，并选择委托银行代为发布融资项目信息，请与您的客户经理联系。"
        });
        //协议链接
        var URLDM = new UDM({
            value:{
                agreement:{
                    name:"",
                    link:""
                },//协议链接
                agreement2:{
                    name:"",
                    link:""
                }//第二种协议链接
            }
        });

        /*ajax请求数据*/
        var ajaxFn = function(){
//            btnDM.setValue({disabled:false});
            accTypeDM.setValue(1);
            companyNameDM.setValue('ddddd');
            contactsDM.setValue('ddddd');
            setTimeout(function () {
                banksDM.setValue({selectValue:'2',
                    options:[
                        {option:"绵阳银行",value:"1"},
                        {option:"中国工商银行",value:"2"},
                        {option:"绵阳银行",value:"1"},
                        {option:"中国工商银行",value:"2"},
                        {option:"绵阳银行",value:"1"},
                        {option:"中国工商银行",value:"2"},
                        {option:"交通银行",value:"3"}]});
            },2000)

//            btnDM.setValue({disabled:false});
            typeSituationDM.setValue({assetTypeId:1,disableType:2});

            URLDM.setValue({
                agreement:{
                    name:"绵阳市商业银行平台服务协议（个人版）",
                    link:""
                },
                agreement2:{
                    name:"绵阳市商业银行平台服务协议（个人版）2",
                    link:""
                }
            })
        };

        var PageDM = {
            accType: accTypeDM,
            typeSituation:typeSituationDM,
            companyName:companyNameDM,
            contacts:contactsDM,
            contactsPhone:contactsPhoneDM,
            banks:banksDM,
            bankNum:bankNumDM,
            checkbox:checkboxDM,
            btn:btnDM,
            user:userDM,
            URL:URLDM
        };
        UEventHub.on('pageLoad',function(){
            ajaxFn();
        });
    </script>
<script type="text/javascript" src="../Borrow\index.js"></script></body>
</html>